package ginfox

import (
	config "westarry/gin-fox/gin-fox/config"
	db "westarry/gin-fox/gin-fox/db"
	logger "westarry/gin-fox/gin-fox/logger/applicationLogger"
	redis "westarry/gin-fox/gin-fox/redis"
	utils "westarry/gin-fox/gin-fox/utils"

	"gorm.io/gorm"
)

var Gc *Gcore

func init() {
	Gc = &Gcore{}
	Gc.L = logger.InitLogger() //初始化logger
	go Gc.L.I.Println("logger初始化成功")
	Gc.C = config.InitConfig() //初始化配置
	go Gc.L.I.Println("全局配置初始化成功")
	Gc.R = redis.InitRedis() //初始化redis
	go Gc.L.I.Println("redis初始化成功")
	Gc.D = db.InitDb() //初始化Db
	go Gc.L.I.Println("Db初始化成功")
	Gc.U = utils.InitUtils() //初始化utils
	go Gc.L.I.Println("utils初始化成功")
	go Gc.L.I.Println("Core初始化完成,ginfox已启动")

}

type Gcore struct {
	C *config.GlobalConfig //全局配置
	U *utils.Utils         //工具
	D *gorm.DB             //Db
	R *redis.Redis         //redis
	L *logger.L
}
